import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
import { Confirm, Message, Notification } from './hook-types'

export const confirm: Confirm = (message, callback, type = 'info', title = '提示') => {
  ElMessageBox.confirm(message, title, {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: type
  }).then(() => {
    callback()
  })
}

export const message: Message = (message, type = 'error') => {
  ElMessage({
    message,
    type
  })
}

export const notification: Notification = (message, title = '提示', type = 'info') => {
  ElNotification({
    title,
    message,
    type
  })
}
